import request from '@/utils/request'

// 获取商品列表
export function getGoodList(params) {
  return request({
    url: '/good/list',
    method: 'GET',
    params
  })
}

// 根据ID获取商品详情
export function getGoodById(id) {
  return request({
    url: `/good/${id}`,
    method: 'GET'
  })
}

// 添加商品
export function addGood(data) {
  return request({
    url: '/good',
    method: 'POST',
    data
  })
}

// 更新商品
export function updateGood(id, data) {
  return request({
    url: `/good/${id}`,
    method: 'PUT',
    data
  })
}

// 删除单条商品
export function deleteGood(id) {
  return request({
    url: `/good/${id}`,
    method: 'DELETE'
  })
}

// 批量删除商品
export function batchDeleteGoods(ids) {
  return request({
    url: '/good/batch',
    method: 'DELETE',
    data: ids
  })
}

